# ============================================================
# * Copyright © hk. 2022-2025. All rights reserved.
# * File name: CMakeLists.txt
# * Author   : 苏木
# * Date     : 2025-05-22
# * Version  : 
# * Description: cmake version 3.16.3
# ============================================================
## https://cmake.com.cn/cmake/help/latest/guide/tutorial/index.html
## https://cmake.org/cmake/help/latest/

# 指定 CMake 的最低版本要求
# --------------------------------------------------
cmake_minimum_required(VERSION 3.10)


# 设置项目名称和使用的编程语言
# --------------------------------------------------
project(SPROJECT C)


# 指定可执行程序和源文件
# --------------------------------------------------
add_executable(app_demo.out main.c)

# include包含.cmake文件, include指令一般用于语句的复用
# --------------------------------------------------
# 如果有一些语句需要在很多CMakeLists.txt文件中使用，为避免重复编写，可以将其写在.cmake文件中
# include(<file|module> [OPTIONAL] [RESULT_VARIABLE <var>] [NO_POLICY_SCOPE])
# 如果存在可选选项[OPTIONAL]，则如果文件不存在，也不会引发错误。
# 如果给出了RESULT_VARIABLE，则变量<var>将被设置为已包含的完整文件名，如果失败，则设置为NOTFOUND。

# 从给定的文件中加载并运行CMake代码。
message(STATUS "[USER:TOP]==> ${CMAKE_VERSION} 加载并运行.cmake文件")
message(STATUS "[USER:TOP]before include!CMAKE_CURRENT_LIST_DIR  : ${CMAKE_CURRENT_LIST_DIR}")
message(STATUS "[USER:TOP]before include!CMAKE_CURRENT_LIST_FILE : ${CMAKE_CURRENT_LIST_FILE}")
message(STATUS "[USER:TOP]before include!CMAKE_CURRENT_LIST_LINE : ${CMAKE_CURRENT_LIST_LINE}")
message("")
include(cmake_file/config.cmake)
message("")
message(STATUS "[USER:TOP]after include!CMAKE_CURRENT_LIST_DIR  : ${CMAKE_CURRENT_LIST_DIR}")
message(STATUS "[USER:TOP]after include!CMAKE_CURRENT_LIST_FILE : ${CMAKE_CURRENT_LIST_FILE}")
message(STATUS "[USER:TOP]after include!CMAKE_CURRENT_LIST_LINE : ${CMAKE_CURRENT_LIST_LINE}")
message("")
message(STATUS "[USER:TOP]config_var : ${config_var}")
message("")
